
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>档案管理-一条数据</title>
<!--[if lt IE 9]>
  <script src="libs/html5shiv.min.js"></script>
  <script src="libs/respond.min.js"></script>
  <![endif]-->
<script src="libs/jquery-1.12.1.min.js"></script>
<link href="libs/bootstrap-3.3.6/css/bootstrap.min.css" rel="stylesheet">
<script src="libs/bootstrap-3.3.6/js/bootstrap.min.js"></script>
<script src="libs/handlebars.min.js"></script>
<script src="libs/js.cookie-2.1.0.min.js"></script>
<script src="libs/getQueryString.js"></script>
<script src="libs/md5.min.js"></script>
<script src="libs/jquery.backstretch.min.js"></script>
<link href="libs/bootstrap-3.3.6/css/dropzone.css" rel="stylesheet">
<script src="libs/dropzone.js"></script>
<script src="libs/dateFormat.js"></script>
</head>
<body>
	<div class="container">
		<div class="row">
			<div class="page-header">
				<h1 align="center">
					<strong>档案管理</strong>
				</h1>
			</div>
		</div>
	</div>
	<div class="container">
		<div class="row">
			<div class="col-md-12">
				<ul class="nav nav-pills ">
					<li><a href="index.html">首页</a></li>
					<li><a href="add.html"><strong>档案添加</strong></a></li>
					<li class="active"><a href="queryone.html"><strong>查询详细</strong></a></li>
					<li><a href="query.html"><strong>档案查询</strong></a></li>
					<li><a href="zhaopian.html"><strong>照片详情</strong></a></li>
					<li><a href="tongji.html"><strong>统计</strong></a></li>
				</ul>
			</div>
		</div>
	</div>

	<div class="container">
		<!-- Nav tabs -->
		<ul class="nav nav-tabs" role="tablist">
			<li role="presentation" class="active"><a href="#home"
				aria-controls="home" role="tab" data-toggle="tab">详情</a></li>
			<li role="presentation"><a href="#profile"
				aria-controls="profile" role="tab" data-toggle="tab">照片</a></li>
			<li role="presentation"><a href="#messages"
				aria-controls="messages" role="tab" data-toggle="tab">上传文件</a></li>
		</ul>

		<!-- Tab panes -->
		<div class="tab-content">
			<div role="tabpanel" class="tab-pane active" id="home">
				<div class="panel-body" id="list1">
					<div class="container">
						<h1>
							<div class="row">
								<div class="col-md-8">
									<table border="2px">
										<tr>
											<td><strong>id:</strong></td>
											<td><input id="text1" readonly="readonly" /></td>
										</tr>
										<tr>
											<td><strong>档案号：</strong></td>
											<td><input id="text2" readonly="readonly" /></td>
										</tr>
										<tr>
											<td><strong>身份证号：</strong></td>
											<td><input id="t" readonly="readonly" /></td>
										</tr>
										<tr>
											<td><strong>姓名：</strong></td>
											<td><input id="text4" /></td>
										</tr>
										<tr>
											<td><strong>性别:</strong></td>
											<td><input id="text5" /></td>
										</tr>
										<tr>
											<td><strong>出生日期:</strong></td>
											<td><input id="text6" /></td>
										</tr>
										<tr>
											<td><strong>预退休日期:</strong></td>
											<td><input id="text7" /></td>
										</tr>
										<tr>
											<td><strong>实际退休日期:</strong></td>
											<td><input id="text8" /></td>
										</tr>
										<tr>
											<td><strong>特殊工种:</strong></td>
											<td><input id="text9" /></td>
										</tr>
										<tr>
											<td><strong>女管理岗位:</strong></td>
											<td><input id="text10" /></td>
										</tr>
										<tr>
											<td><strong>职称：</strong></td>
											<td><input id="text11" /></td>
										</tr>
										<tr>
											<td><strong>工龄：</strong></td>
											<td><input id="text12" /></td>
										</tr>
									</table>
									<div class="col-md-5">
										<button id="update" class="btn btn-primary btn-block">修改</button>
									</div>
									<div class="col-md-5">
										<button id="dele" class="btn btn-primary btn-block">删除</button>
									</div>
								</div>
							</div>
						</h1>
					</div>
				</div>
			</div>
			<div role="tabpanel" class="tab-pane" id="profile"></div>

			<div role="tabpanel" class="tab-pane" id="messages">
				<form id="form" action="" method="post"
					enctype="multipart/form-data">

					<input type="file" name="file" />

					<button type="submit">上传</button>

				</form>
				<form id="dropzone" action="" class="dropzone" method="post"></form>
			</div>
		</div>
	</div>
	<script id="template" type="text/x-handlebars-template">
    {{#each item}}
    <div class="col-md-3">
		<div class="thumbnail">
			<a href='zhaopian.html?id={{id}}'><img src="upload/{{archive_id}}/{{name}}" /></a>
          
		</div>
    </div>
    {{/each}}
  </script>
	<script type="text/javascript">
		var id = getQueryString('id');
		Dropzone.options.dropzone = {
			url : id + '/upload.action',
			clickable : true,
			acceptedFiles : '.jpg',
			dictDefaultMessage : '拖放图片文件到此位置',
			dictInvalidFileType : '错误的文件类型',
			dictFileTooBig : '文件过大',
			dictResponseError : '与服务器连接失败',
			dictCancelUpload : '已取消',
			dictCanceluploadConfirmation : '确认取消上传'
		}
	</script>



	<script type="text/javascript">
		$(function() {
			var id = getQueryString('id');
			var url = 'query_one.action?id=' + id;
			$.getJSON(url, function(res) {
				console.log(res[0].identity);
				$('#text1').val(res[0].id);
				$('#text2').val(res[0].archive_id);
				$('#t').val(res[0].identity);
				$('#text4').val(res[0].name);
				$('#text5').val(res[0].gender);
				$('#text6').val(res[0].birthday);
				$('#text7').val(res[0].date_retire1);
				$('#text8').val(res[0].date_retire2);
				$('#text9').val(res[0].sp);
				$('#text10').val(res[0].fc);
				$('#text11').val(res[0].title);
				$('#text12').val(res[0].seniority);
			})
		})
	</script>
	<script type="text/javascript">
		$(function() {
			var id = getQueryString('id');
			$('#form').attr('action', id + '/upload.action');
			$.getJSON('queryjpg.action?id=' + id, function(res) {
				console.log(res);
				var data = {
					'item' : res
				};
				var t = Handlebars.compile($('#template').html());
				$('#profile').html(t(data));
			})

		})
	</script>
	<script type="text/javascript">
		$.backstretch("69.jpg");
	</script>
	<script type="text/javascript">
		$(function() {
			var id = getQueryString('id');
			var url = 'update.action?id=' + id;
			$('#update').click(function() {
				$.post(url, {
					archive_id : $('#text2').val(),
					identity : $('#t').val(),
					name : $('#text4').val(),
					gender : $('#text5').val(),
					birthday : $('#text6').val(),
					date_retire1 : $('#text7').val(),
					date_retire2 : $('#text8').val(),
					sp : $('#text9').val(),
					fc : $('#text10').val(),
					title : $('#text11').val(),
					seniority : $('#text12').val()
				}, function(res, status) {
					console.log(res);
					if (res == "OK") {
						alert('修改成功');
					}

				});
			});
		})
	</script>
	<script type="text/javascript">
		$(function() {
			var id = getQueryString('id');
			var url = 'query_one.action?id=' + id;
			$.getJSON(url, function(res) {
				console.log(res);
				$('#dele').click(function() {
					$.post('dele.action', {
						id : id
					}, function(res, status) {
						//加IF判断是否删除
						window.location.href = 'index.html';
					})
				})
			})
		})
	</script>
	<script type="text/javascript">
		$('#myTabs a').click(function(e) {
			e.preventDefault()
			$(this).tab('show')
		})
	</script>
	<script type="text/javascript">
		if (!Cookies.get("user")) {
			window.location.href = 'login.html';
		}
	</script>

</body>
</html>
